feat(laguna): add poolside/Laguna-S-2.1 support via a dedicated renderer - #111
Open
eexwhyzee wants to merge 3 commits into
Open
feat(laguna): add poolside/Laguna-S-2.1 support via a dedicated renderer#111eexwhyzee wants to merge 3 commits into
eexwhyzee wants to merge 3 commits into
Conversation
ApprovabilityVerdict: Needs human review This PR adds a new renderer and config for the Laguna-S-2.1 model. While the implementation is clean and well-tested, it introduces new user-facing capability and new components, which warrants human review per repository standards. You can customize Macroscope's approvability policy. Learn more. |
eexwhyzee
force-pushed
the
feature/laguna-s-2.1-route
branch
from
July 24, 2026 17:36
268b752 to
cdc158e
Compare
S-2.1 is a larger sibling of XS-2.1 (48 layers, hidden 3072, top-10 of 256 experts) but ships a byte-identical chat_template.jinja and tokenizer (same special tokens/ids, same vocab). It reuses LagunaXS21Renderer via an exact-match MODEL_RENDERER_MAP entry; no new renderer/config/parser needed. Added to the shared render-parity matrices (config-parity, is_content, sampled_mask); token-exact parity against apply_chat_template verified for both enable_thinking polarities across all conversation shapes.
…late The initial routing (cdc158e) assumed S-2.1 shipped a byte-identical chat template to XS-2.1 and reused LagunaXS21Renderer. It doesn't: S-2.1 shares XS-2.1's tokenizer (same vocab/merges/special tokens) but its template defaults enable_thinking to True (XS-2.1 defaults False) and adds a preserve_thinking kwarg, widening the reasoning-display gate to `enable_thinking or preserve_thinking`. Reusing the XS-2.1 renderer mismatched apply_chat_template on the default flag (bare `</think>` vs empty `<think></think>` wrapper), failing test_render_ids / test_build_helpers. The config-parity barrage missed this because it always sets enable_thinking explicitly, never exercising the differing default. Add LagunaS21RendererConfig (enable_thinking=True, preserve_thinking=False) and LagunaS21Renderer, a thin LagunaXS21Renderer subclass that overrides only the reasoning-display gate. Route poolside/Laguna-S-2.1 to it. The token format is otherwise identical, so everything else is inherited. Verified token-exact against apply_chat_template for all enable_thinking × preserve_thinking combinations; added tests/test_laguna_s21.py for the S-2.1-specific behaviours the shared barrage can't reach. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The renderer/config landed in the previous commit but was missing from the user-facing listings, which now cover its sibling M.1 (#120): the README renderer roster, the per-renderer config table, and the thinking_retention default table. `LagunaS21RendererConfig.template_field_names()` is {enable_thinking, preserve_thinking}, and the renderer inherits XS.2's ``all`` retention default, so it joins that row. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
eexwhyzee
force-pushed
the
feature/laguna-s-2.1-route
branch
from
August 8, 2026 19:41
058218d to
29606c6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds renderer support for
poolside/Laguna-S-2.1, a larger sibling of XS-2.1.S-2.1 shares XS-2.1's tokenizer (same vocab, merges, and special tokens/ids) but ships a different chat template: it defaults
enable_thinkingtoTrue(XS-2.1 defaultsFalse) and adds apreserve_thinkingkwarg that widens the reasoning-display gate toenable_thinking or preserve_thinking. The token format is otherwise identical.Changes
LagunaS21RendererConfig—enable_thinking=True,preserve_thinking=Falsedefaults, matching S-2.1's template. Registered in the discriminated union,_CONFIG_BY_NAME, and exports.LagunaS21Renderer— a thinLagunaXS21Renderersubclass that overrides only the reasoning-display gate (enable_thinking or preserve_thinking); everything else (role tags, tool-call packing, system-block gate, generation prompt, parse skeleton) is inherited unchanged.poolside/Laguna-S-2.1→laguna-s-2.1inMODEL_RENDERER_MAP; register the renderer; lazy-import + exports.__init__accepts the config union; subclass narrowsself.config).Testing
tests/test_laguna_s21.py: token-exact parity vsapply_chat_templatefor all fourenable_thinking × preserve_thinkingcombinations, plus the thinking-on default and thepreserve_thinkinghistory-retention behaviour.ruff+tyclean (no new diagnostics vs main).🤖 Generated with Claude Code
Note
Low Risk
Additive model routing and a small renderer subclass with focused parity tests; no changes to auth, data handling, or existing Laguna render paths beyond a shared hook in XS-2.1 assistant rendering.
Overview
Adds first-class support for
poolside/Laguna-S-2.1, which shares XS-2.1’s tokenizer but uses a different chat template (enable_thinkingdefaults toTrueand a newpreserve_thinkingkwarg gates whether historical<think>blocks render).LagunaS21RendererConfigandLagunaS21Renderer(a thinLagunaXS21Renderersubclass) implement that template: the subclass only overrides the reasoning-display gate toenable_thinking or preserve_thinking.LagunaXS21Renderernow routes assistant history through_render_history_reasoning()so XS-2.1 and S-2.1 can diverge without duplicating render logic.Wiring updates map the checkpoint in
MODEL_RENDERER_MAP, registerlaguna-s-2.1in the config union/registry/exports, and document the variant in README anddocs/renderer-config.md.tests/test_laguna_s21.pyplus shared parity matrices cover auto-resolution, default thinking-on behavior, all flag combinations vsapply_chat_template, andpreserve_thinkingwhen thinking is off.Reviewed by Cursor Bugbot for commit 29606c6. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add
LagunaS21Rendererfor thepoolside/Laguna-S-2.1modelLagunaS21Rendererin renderers/laguna_xs2.py as a subclass ofLagunaXS21Renderer, with a dedicatedLagunaS21RendererConfig(in renderers/configs.py) that adds apreserve_thinkingflag alongside the existingenable_thinking.enable_thinkingorpreserve_thinkingisTrue; both default toTrueandFalserespectively, so thinking is on by default.poolside/Laguna-S-2.1tolaguna-s-2.1inMODEL_RENDERER_MAPand the renderer registry.Macroscope summarized 29606c6.